<?php
namespace App\Filters;

use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;

class AdminAuth implements FilterInterface
{

    public function before(RequestInterface $request, $arguments = null)
    {
        // Do something here
        if (! session()->get('isLoggedIn')) {
            // return redirect()->route('login');
            $url = base_url('login');
            exit("<html><script>window.open ('" . $url . "','_top')</script></html>");
        }
    }

    // --------------------------------------------------------------------
    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {
        // Do something here
    }
}